<template>
	<view class="block-swipers">
		<swiper :style="{height:listHeight+'px'}" class="block-swipers" :indicator-dots="dots" :autoplay="autoplay"
			:circular="circular" :interval="interval" :duration="duration">
			<swiper-item v-for="(item,index) in data" :key="index">
				<view class="list-swiper" @click="goPage(item.type,item.href)">
					<image mode="aspectFill" :src=" item.image"></image>
				</view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		name: "BlockSwipers",
		props: {
			data:{
				type:[Array],
				default () {
					return [];
				}
			},
			dots: {
				type: [Boolean],
				default: true
			},
			autoplay: {
				type: [Boolean],
				default: true
			},
			circular: {
				type: [Boolean],
				default: true
			},
			interval: {
				type: [Number],
				default: 3000
			},
			duration: {
				type: [Number],
				default: 500
			},
			listHeight:{
				type:[Number],
				default:150
			}
		},
		methods:{
			goPage(type,url){
				if(type === 1){
					uni.navigateTo({
						url:url
					})
				}
				if(type === 2){
					uni.navigateTo({
						url:"/pages/link/link?url="+url
					})
				}
			}
		}
	}
</script>

<style lang="less" scoped src="./BlockSwipers.less"></style>
